<?php
/**
 * Created by qinpeizhou.
 * Date: 2018/2/24
 * Time: 15:29
 * Email : 1031219129@qq.com
 */

include_once( dirname(__FILE__).'/../models/Banner.php');
include_once( dirname(__FILE__).'/../models/Product.php');
include_once( dirname(__FILE__).'/../library/exception/BannerException.php');
include_once( dirname(__FILE__).'/Base_Controller.php');



class BannerController extends Base_Controller
{

    public function indexAction(){
        echo json_encode( ['hello'=>'myyaf'] );
        return FALSE;
    }

    /**
     * 获取轮播图以及轮播图商品信息
     * @url    http://localhost/my_yafapi/banner
     * @author qinpeizhou
     * @return bool
     * @throws BannerException
     */
    public function  getBannerAction(){
        $bannerModel = new BannerModel();
        $banners = $bannerModel->getBanners();
         if(!$banners){
            throw  new BannerException();
         }

        show('ok',$banners,201);
        return FALSE;
    }
}
